import { createApp } from 'vue'
import App from './App.vue'
import router from './router'
import store from './store'
import installElementPlus from './plugins/element'
import initNProgress from './plugins/nprogress'
import {
  request,
  globalFilter,
  message,
  notification,
  loading,
  dayjs,
} from '@/utils'

// 测试环境默认使用mock模拟数据
if (process.env.NODE_ENV === 'development') {
  const { mockXHR } = require('@/utils/mockXHR')
  mockXHR()
}

// 初始化进度条
initNProgress()

const app = createApp(App)

// element-plus ui
installElementPlus(app)

//定义过滤器
globalFilter(app)

//定义全局变量
app.config.globalProperties.$request = request
app.config.globalProperties.$message = message
app.config.globalProperties.$loading = loading
app.config.globalProperties.$dayjs = dayjs
app.config.globalProperties.$notification = notification

app.use(store).use(router).mount('#app')
